package chapter04;

public class Test08_exceptionClass {
    public static void main(String[] args) {
        System.out.println(divide(10,5));
        System.out.println(divide(10,-10));
    }
    public static int divide(int a,int b){
        if(b<0){
            throw new DivideMinusException("负数不能做除数");
        }else{
            return a/b;
        }
    }
}
class DivideMinusException extends RuntimeException{
    public DivideMinusException() {
        super();
    }
    public DivideMinusException(String message) {
        super(message);
    }
}